#include <opencv2/opencv.hpp>
#include <iostream>

using namespace cv;
using namespace std;

int main() {

    Mat img = imread("bed.PNG");

    Mat hsv;
    cvtColor(img, hsv, COLOR_BGR2HSV);


    Scalar lower_pink = Scalar(150, 50, 50);
    Scalar upper_pink = Scalar(180, 255, 255);

    Mat mask;
    inRange(hsv, lower_pink, upper_pink, mask);


    Mat result;
    bitwise_and(img, img, result, mask);

    imshow("原始图像", img);
    imshow("颜色分割结果", result);
    imwrite("result.jpg", result);

    waitKey(0);
    return 0;
}
